package game.hiram;

public class Player extends Entity {
	private Inventory inventory = new Inventory();
	private EInventory equipment = new EInventory();
	private int rights;

	public Player() {
		super();

	}

	public void useItem(Item i) {
		if (i instanceof Equipment) {
			equip((Equipment) i);
		} else {
			
		}
	}

	public void equip(Equipment e) {
		Equipment temp = null;
		switch (e.getType()) {
		case Weapon:
			temp = equipment.getWeapon();
			equipment.setWeapon((Weapon) e);
			break;
		case Boots:
			temp = equipment.getBootsEquipment();
			equipment.setBootsEquipment(e);
			break;
		case Plate:
			temp = equipment.getPlateEquipment();
			equipment.setPlateEquipment(e);
			break;
		case Legs:
			temp = equipment.getLegsEquipment();
			equipment.setLegsEquipment(e);
			break;
		case Gloves:
			temp = equipment.getGlovesEquipment();
			equipment.setGlovesEquipment(e);
			break;
		case Necklace:
			temp = equipment.getNeckEquipment();
			equipment.setNeckEquipment(e);
			break;
		case Ring:
			temp = equipment.getRingEquipment();
			equipment.setRingEquipment(e);
			break;
		case Helm:
			temp = equipment.getHelmEquipment();
			equipment.setHelmEquipment(e);
			break;
		case Ammunition:
			temp = equipment.getAmmunition();
			equipment.setAmmunition((Ammunition) e);
			break;
		case Offhand:
			temp = equipment.getOffhand();
			equipment.setOffhand((Offhand)e);
			break;
		default:
			return;
		}
		if (temp != null) {
			inventory.add(temp);
		}
		inventory.remove(e);
	}

	@Override
	public void die() {
		// TODO
	}

	@Override
	public void update() {
		// TODO Auto-generated method stub

	}
}
